From e747ec3ea02dd01e9ffa9e398e24e6939a5b738c Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Wed, 6 Dec 2023 17:47:41 -0500 Subject: Tabs --- src/app/groups/[groupId]/page.tsx | 132 +------------------------------------- 1 file changed, 2 insertions(+), 130 deletions(-) (limited to 'src/app/groups/[groupId]/page.tsx') diff --git a/src/app/groups/[groupId]/page.tsx b/src/app/groups/[groupId]/page.tsx index 7fffcb3..b28c3c9 100644 --- a/src/app/groups/[groupId]/page.tsx +++ b/src/app/groups/[groupId]/page.tsx @@ -1,137 +1,9 @@ -import { BalancesList } from '@/app/groups/[groupId]/balances-list' -import { SaveGroupLocally } from '@/app/groups/[groupId]/save-recent-group' -import { Badge } from '@/components/ui/badge' -import { Button } from '@/components/ui/button' -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from '@/components/ui/card' -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, -} from '@/components/ui/table' -import { getGroup, getGroupExpenses } from '@/lib/api' -import { getBalances } from '@/lib/balances' -import { ChevronRight, Plus } from 'lucide-react' -import Link from 'next/link' -import { notFound } from 'next/navigation' +import { redirect } from 'next/navigation' export default async function GroupPage({ params: { groupId }, }: { params: { groupId: string } }) { - const group = await getGroup(groupId) - if (!group) notFound() - - const expenses = await getGroupExpenses(groupId) - const balances = getBalances(expenses) - - return ( - <> - -
- - Expenses - - Here are the expenses that you created for your group. - - - - - -
- - - {expenses.length > 0 ? ( - - - - Title - Paid by - Paid for - Amount - - - - - {expenses.map((expense) => ( - - {expense.title} - - - { - group.participants.find( - (p) => p.id === expense.paidById, - )?.name - } - - - - {expense.paidFor.map((paidFor, index) => ( - - { - group.participants.find( - (p) => p.id === paidFor.participantId, - )?.name - } - - ))} - - - {group.currency} {expense.amount.toFixed(2)} - - - - - - ))} - -
- ) : ( -
Your group doesn’t have any expense yet.
- )} -
-
- - - - Balances - - This is the amount that each participant paid or was paid for. - - - - - - - - - ) + redirect(`/groups/${groupId}/expenses`) } -- cgit v1.3